<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    const tmp = undefined;

    const b=null;



    /*
    *      ==  判断内容
    *     ===判断内容 和 类型        记住  null 的类型是 object
    * */

    //true
    console.log(tmp==undefined)           //true
    console.log((typeof tmp)==undefined )  //false
    console.log((typeof tmp)=='undefined' )   //true


    console.log(typeof tmp)

    const str=typeof tmp;

    //String
    console.log(typeof str)

    //内容和 类型都相等
    console.log(tmp===undefined)


    //true        可以看做null 和  undefined的内容都为空  所以相等
    console.log(b==undefined)
    console.log(typeof b)

    //false  内容相等  类型不一样  一个是 object 一个是undefined
    console.log(b===undefined)

    console.log(b===null)


    console.log("if中的条件转化*******************************************************")

    console.log(Boolean(null));   //false
    console.log(Boolean(undefined));  //false
    console.log(Boolean(0));          //false
    console.log(Boolean(NaN))   //false
    console.log(Boolean("鲁大师" - 1));  //false

    console.log(Boolean(-1.2));        // 不等于0 数字都是true
    console.log(Boolean('鲁大师'));   //true
    console.log(Boolean("11" + 1));  //true
    console.log(Boolean("11" - 1));  //true

    console.log("11"-1)   //10  字符数字隐式转化

    console.log(Boolean("鲁大师" - 1));  //false

    console.log("鲁大师"-1)   //NaN  隐式转化

    console.log(Boolean(NaN))   //false



    console.log("if中的条件转化*******************************************************")


    console.log(bbbbbb);

    const aaa=null;

    const ccc=undefined;
    alert( (typeof ccc)=='undefined')
    alert( (typeof ccc)==undefined)


    //判断null的方式一
    if(aaa===null){
        alert('is null')
    }

    alert(typeof aaa) //object
    alert(typeof (typeof aaa))



    if (!aaa && typeof(aaa)!='undefined' && aaa!=0)
    {
        alert('is null')
    }


    const  bbb=''

    console.log(!null);
    console.log(!undefined)

    console.log(!bbb)
    console.log(!0)


    if('鲁大师'){
        console.log("我是鲁大师")
    }


</script>

</body>
</html>